package cn.niit.letuseatdemo.service.impl;

import cn.niit.letuseatdemo.entity.domain.UserOrder;
import cn.niit.letuseatdemo.mapper.UserOrderMapper;
import cn.niit.letuseatdemo.service.UserOrderService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: JinNa ToDo
 * @Date: 2022/11/06/16:54
 * @Description:
 */
@Service
public class UserOrderServiceImpl implements UserOrderService {
    @Autowired
    private UserOrderMapper userOrderMapper;

    /*
    * @Description: 查询订单列表${TODO}
    * @Author: Jin_Na
    * @CreateTime: 2022/11/6 17:23
     * @param: orderId
     * @return: 订单
    **/

    @Override
    public UserOrder selectUserOrderByOrderId(Integer orderId) {
        return userOrderMapper.selectUserOrderByOrderId(orderId);
    }

    /*
    * @Description: 查询订单列表
     * @param: userOrder
     * @return: java.util.List<cn.niit.letuseatdemo.entity.domain.UserOrder>
    **/
    @Transactional
    @Override
    public List<UserOrder> selectUserOrderList(UserOrder userOrder){
        return userOrderMapper.selectUserOrderList(userOrder);
    }

    /*
    * @Description: 新增订单
     * @param: userOrders
    **/
    @Override
    public int insert(UserOrder userOrder) {
        return userOrderMapper.insertUserOrder(userOrder);
    }

    /*
    * @Description:删除订单
     * @param: orderId
     * @return: int
    **/
    @Override
    public int deleteUserOrderByOrderId(Integer orderId) {
        return userOrderMapper.deleteUserOrderByOrderId(orderId);
    }

    /*
    * @Description: 修改订单状态
     * @param: userOrder
     * @return: int
    **/
    @Override
    public int updateUserOrderStatus(UserOrder userOrder) {
        return userOrderMapper.updateUserOrderStatus(userOrder);
    }
}



